<template>
	<view class="layout pageBg">
		<custom-nav-bar title="分类"></custom-nav-bar>
		<view class="classify">
			<theme-item v-for="item in classifyList" :key="item._id" :item="item"></theme-item>
		</view>
	</view>
</template>

<script setup>
import { ref } from 'vue';
import {onPullDownRefresh,  onShareAppMessage, onShareTimeline} from "@dcloudio/uni-app"
import {apiGetClassify} from '@/apis/apis.js'

const classifyList = ref([])

//分享给朋友
onShareAppMessage(()=>{
	return {
		title:"卷毛壁纸手机换肤",
		path:"/pages/classify/classify",
		imageUrl:"/static/images/logo.png"
	}
})

//分享朋友圈
onShareTimeline(()=>{
	return {
		title:"卷毛壁纸手机换肤",
		imageUrl:"/static/images/logo.png"
	}
})

//下拉刷新
onPullDownRefresh(()=>{
	classifyList.value= []
	getClassify()
	uni.stopPullDownRefresh()
})

//获取分类数据
const getClassify = async ()=>{
	let res = await apiGetClassify({pageSize:20})
	classifyList.value = res.data
	// console.log(res)
}

getClassify()
</script>

<style lang="scss" scoped>
.layout{
	.classify{
		padding: 30rpx;
		display: grid;
		grid-template-columns: repeat(3,1fr);
		gap: 15rpx;
	}
}
</style>
